package com;

import java.util.IdentityHashMap;
import java.util.Map;

import org.apache.hadoop.conf.Configuration;

import com.ls.fw.hadoop.client.base.BaseHadoopDao;
import com.ls.fw.hadoop.client.base.impl.BaseHadoopDaoImpl;
import com.ls.fw.hadoop.client.constant.NamenodeJMXEnum;
import com.ls.fw.hadoop.client.util.HadoopClientUtils;

public class test {

	private static final String QRY = "qry";

	public static void main(String args[]) throws Exception {
		BaseHadoopDao d = new  BaseHadoopDaoImpl();
		Configuration conf = new  Configuration();
		conf.set("fs.defaultFS", "hdfs://cluster1");
		conf.set("ha.zookeeper.quorum", "node1:2181,node3:2181,node4:2181");
		conf.set("dfs.nameservices", "cluster1");
		conf.set("dfs.ha.namenodes.cluster1", "nn1,nn2");
		conf.set("dfs.namenode.rpc-address.cluster1.nn1", "node1:9000");
		conf.set("dfs.namenode.rpc-address.cluster1.nn2", "node3:9000");
		conf.set("dfs.client.failover.proxy.provider.cluster1", "org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");
		d.switchConf("hdfs://node3:9000",conf );
		System.out.println(d.getNamenodeList());
		System.out.println(HadoopClientUtils.getState("http://192.168.200.241:50070/jmx"));
		Map<String,String> paraMap  = new IdentityHashMap<String,String>();
		paraMap.put(new String(QRY), NamenodeJMXEnum.INFO.code());
		paraMap.put(new String(QRY), NamenodeJMXEnum.STATUS.code());
		
		System.out.println(HadoopClientUtils.namenodeInfo("http://192.168.200.243:50070/jmx"));
	}

}
